from django.shortcuts import render

from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import viewsets
from .models import Post
from .serializers import PostSerializer 

# Create your views here.
"""
class PostView(APIView):
    def get(self, request):
        Post_list = Post.objects.all()
        serializer = PostSerializer(Post_list, many=True)
 
        return Response(serializer.data)
"""

class PostViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows users to be viewed or edited.
    """
    queryset = Post.objects.all()
    serializer_class = PostSerializer